package subcommands

import "github.com/urfave/cli"

func GenCliCommands() []cli.Command {
	return []cli.Command{
		{
			Name:  "list",
			Usage: "list host info",
			Flags: []cli.Flag{
				cli.StringSliceFlag{
					Name:  "group, g",
					Usage: "group names",
				},
				cli.StringSliceFlag{
					Name:  "node, n",
					Usage: "node names",
				},
				cli.BoolFlag{
					Name:  "p",
					Usage: "display password or not",
				},
			},
			Action: ListCli,
		}, // list
		{
			Name:  "login",
			Usage: "login host",
			Flags: []cli.Flag{
				cli.StringFlag{
					Name:  "node, n",
					Usage: "node name",
				},
				cli.StringFlag{
					Name:  "user, u",
					Usage: "user name",
				},
			},
			Action: LoginCli,
		}, // login
		{
			Name:  "get",
			Usage: "get file/directory from remote host",
			Flags: []cli.Flag{
				cli.StringFlag{
					Name:  "node, n",
					Usage: "node name",
				},
				cli.StringFlag{
					Name:  "group, g",
					Usage: "group name",
				},
				cli.StringFlag{
					Name:  "user, u",
					Usage: "user name",
				},
				cli.StringFlag{
					Name:  "from, f",
					Usage: "from path",
				},
				cli.StringFlag{
					Name:  "to, t",
					Usage: "to path",
				},
			},
			Action: GetCli,
		}, // get
		{
			Name:  "put",
			Usage: "put file/directory to remote host",
			Flags: []cli.Flag{
				cli.StringFlag{
					Name:  "node, n",
					Usage: "node name",
				},
				cli.StringFlag{
					Name:  "group, g",
					Usage: "group name",
				},
				cli.StringFlag{
					Name:  "user, u",
					Usage: "user name",
				},
				cli.StringFlag{
					Name:  "from, f",
					Usage: "from path",
				},
				cli.StringFlag{
					Name:  "to, t",
					Usage: "to path",
				},
			},
			Action: PutCli,
		}, // put
		{
			Name:  "set",
			Usage: "config command",
			Flags: []cli.Flag{
				cli.StringFlag{
					Name:  "repo, r",
					Usage: "set repo path",
				},
				cli.StringFlag{
					Name:  "logLevel, l",
					Usage: "set log level(ex. debug warn error)",
				},
				cli.StringFlag{
					Name:  "logType, t",
					Usage: "set log type(ex. console file)",
				},
				cli.StringFlag{
					Name:  "logPath, p",
					Usage: "set log path",
				},
				cli.IntFlag{
					Name:  "execTimeout, e",
					Usage: "set exec timeout, unit(second)",
				},
				cli.IntFlag{
					Name:  "bufferSize, b",
					Usage: "set buffer size for transfer files, unit()",
				},
			},
			Action: SetCli,
		}, // set
		{
			Name:  "exec",
			Usage: "exec commands for remote host",
			Flags: []cli.Flag{
				cli.StringFlag{
					Name:  "node, n",
					Usage: "node name",
				},
				cli.StringFlag{
					Name:  "group, g",
					Usage: "group name",
				},
				cli.StringFlag{
					Name:  "user, u",
					Usage: "user for login node, default is the node's first user info",
				},
				cli.StringFlag{
					Name:  "e",
					Usage: "user for exec command, default is the Login User",
				},
				cli.StringFlag{
					Name:  "cmd, c",
					Usage: "command string",
				},
				cli.BoolFlag{
					Name:  "i",
					Usage: "excute command in interactive mode or not",
				},
			},
			Action: ExecCli,
		}, // exec
	}
}
